import {IReference} from "../Base/ReferencePool/IReference";
import {PlaySoundParams} from "./PlaySoundParams";
import {ReferencePool} from "../Base/ReferencePool/ReferencePool";
import {SoundGroup} from "./SoundGroup";

export class PlaySoundInfo implements IReference{
    get serialId(): number {
        return this._serialId;
    }

    get soundGroup():SoundGroup {
        return this._soundGroup;
    }

    get playSoundParams(): PlaySoundParams {
        return this._playSoundParams;
    }

    get userData() {
        return this._userData;
    }

    private _serialId:number;
    private _soundGroup:SoundGroup;
    private _playSoundParams:PlaySoundParams;
    private _userData;

    constructor() {
        this._serialId = 0;
        this._soundGroup = null;
        this._playSoundParams = null;
        this._userData = null;
    }

    public static Create(serialId:number,soundGroup:SoundGroup,playSoundParams:PlaySoundParams,userData):PlaySoundInfo{
        let playSoundInfo:PlaySoundInfo = ReferencePool.Acquire(PlaySoundInfo);
        playSoundInfo._serialId = serialId;
        playSoundInfo._soundGroup = soundGroup;
        playSoundInfo._playSoundParams = playSoundParams;
        playSoundInfo._userData = userData;
        return playSoundInfo;
    }



    Clear(): void {
        this._serialId = 0;
        this._soundGroup = null;
        this._playSoundParams = null;
        this._userData = null;
    }

}